using System;
using System.Threading;
using System.Threading.Tasks;
using Quartz;

namespace Infrastructure.Quartz
{
    /// <summary>
    /// Quartz调度任务执行监听器
    /// </summary>
    internal class GlobalJobListener : IJobListener
    {
        public string Name => "GlobalJobListener";

        public Task JobExecutionVetoed(IJobExecutionContext context, CancellationToken cancellationToken = default)
        {
            // return Task.Run(() => LogHelper.Information($"Job '{context.JobDetail.Key.Name}' execution vetoed."));
            return Task.Run(() => { });
        }

        public Task JobToBeExecuted(IJobExecutionContext context, CancellationToken cancellationToken = default)
        {
            // return Task.Run(() => LogHelper.Information($"Job '{context.JobDetail.Key.Name}' to be executed."));
            return Task.Run(() => { });
        }

        public Task JobWasExecuted(IJobExecutionContext context, JobExecutionException jobException, CancellationToken cancellationToken = default)
        {
            // return Task.Run(() => LogHelper.Information($"Job '{context.JobDetail.Key.Name}' executed."));
            return Task.Run(() => { });
        }
    }
}